{% extends 'views/base.html' %}
{% block body %}
<form class="was-validated" action="/create" method="POST">
  <header class="editor-header">
    <input name="title" type="text" class="article-header" placeholder="请输入标题...">
    <button class="btn btn-info publish" type="submit">发布</button>
  </header>

  <div id="editor">
    <textarea name="content" class="input"></textarea>
    <div class="markdown-body show content"></div>
  </div>
</form>
{% block script %}
<script src="https://cdn.bootcss.com/marked/0.3.19/marked.min.js"></script>
<script>
  var input = $('#editor .input')
  $('#editor .show').html(marked(input.val()))
  input.on('input', function() {
    $('#editor .show').html(marked($(this).val(), { sanitize: true }))
  })
</script>
{% endblock %}

{% endblock %}